<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
        <title>Document</title>
        <script>
            function showTime(){
                var d = new Date();
                var year = d.getFullYear();
                var month = d.getMonth() + 1;   //0~11
                var date = d.getDate();

                var week = d.getDay();  //0~6  0是周日

                week = numOfChinese(week);

                var hour = doubleNum(d.getHours());
                var min = doubleNum(d.getMinutes());
                var sec = doubleNum(d.getSeconds());

                var str = year + "年" + month + "月" + date + "日 星期" + week + " " + hour + ":" + min + ":" + sec; 
                return str;
            }


            //数字转成中文
            function numOfChinese(num){
                var arr = ["日", "一", "二", "三", "四", "五", "六"];
                return arr[num];
            }

            function doubleNum(n){
                if(n < 10){
                    return "0" + n;
                }else{
                    return n;
                }
            }

            document.write(showTime());
        </script>
    </head>
    <body>
        
    </body>
</html>